<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../../dist/my-picker.css" />
</head>
<body>
</body>
<script type="text/javascript" src="../../dist/my-picker.min.js"></script>
<script>
    var year = [];
    for(var i = 16; i < 30 ; i++){
        year.push(i + 2000);
    }

    var month = [];
    for(var i = 1; i <= 12 ; i++){
        month.push(i);
    }

    window._picker = window.myPicker({
        cols : [{
            options: year,
            suffix: "年",
        },{
            options: month,
            suffix: "月",
        },{
            options: [],
            suffix: "日",
        },],
        onOkClick: function (values) {
            console.log(values);
        },
        setValues: [2017,8,12],
        onSelectItem : function (i, index, value) {

            if(i != 2){
                var year = this.getValue(0);
                var month = this.getValue(1);

                if(year == null || month == null)
                    return

                var curDate = new Date();
                curDate.setYear(year)
                curDate.setMonth(month);
                curDate.setDate(0);

                var day = [];
                for(var i = 1; i <= curDate.getDate() ; i++){
                    day.push(i);
                }
                this.setOptions(2, day);
            }
        }
    });
    window._picker.show();

</script>
</html>
